var t = require;
var e = module;
var o = exports;
var a,
    i =
        (this && this.__extends) ||
        ((a = function (t, e) {
            return (a =
                Object.setPrototypeOf ||
                ({__proto__: []} instanceof Array &&
                    function (t, e) {
                        t.__proto__ = e;
                    }) ||
                function (t, e) {
                    for (var o in e) Object.prototype.hasOwnProperty.call(e, o) && (t[o] = e[o]);
                })(t, e);
        }),
        function (t, e) {
            a(t, e);
            function o() {
                this.constructor = t;
            }
            t.prototype = null === e ? Object.create(e) : ((o.prototype = e.prototype), new o());
        }),
    n =
        (this && this.__decorate) ||
        function (t, e, o, a) {
            var i,
                n = arguments.length,
                r = n < 3 ? e : null === a ? (a = Object.getOwnPropertyDescriptor(e, o)) : a;
            if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) r = Reflect.decorate(t, e, o, a);
            else
                for (var s = t.length - 1; s >= 0; s--)
                    (i = t[s]) && (r = (n < 3 ? i(r) : n > 3 ? i(e, o, r) : i(e, o)) || r);
            return n > 3 && r && Object.defineProperty(e, o, r), r;
        };
Object.defineProperty(o, "__esModule", {value: !0});
var r = cc._decorator,
    s = r.ccclass,
    c = r.property,
    p =
        (r.menu,
        (function (t) {
            i(e, t);
            function e() {
                var e = (null !== t && t.apply(this, arguments)) || this;
                e.viewClick = null;
                e.type = 0;
                e.maxTimeAdd = 0;
                return e;
            }
            e.prototype.onLoad = function () {
                this.checkBtn();
                EVUIEffView.on(EVUIEffView.updateAddMulAd, this.checkBtn.bind(this), this);
            };
            e.prototype.onDestroy = function () {
                EVUIEffView.offTarget(this);
                this.unscheduleAllCallbacks();
            };
            e.prototype.checkBtn = function () {
                if (0 == this.type) {
                    if (PayData.getMulAdd2Pro() > 1) {
                        this._clickNode.active = !0;
                        this.addPropTime(Date.now(), PayData.getMul20Time());
                    } else this._clickNode.active = !1;
                } else if (1 == this.type)
                    if (PayData.getMulAdd5Pro() > 1) {
                        this._clickNode.active = !0;
                        this.addPropTime(Date.now(), PayData.getMul5Time());
                    } else this._clickNode.active = !1;
            };
            e.prototype.addPropTime = function (t, e) {
                this.maxTimeAdd = e;
                if (this.checkOver(t, e)) {
                    this.unscheduleAllCallbacks();
                    this.addTimeCheck();
                    this.schedule(this.addTimeCheck, 1);
                } else this.resetData();
            };
            e.prototype.addTimeCheck = function () {
                if (this.checkOver(Date.now(), this.maxTimeAdd)) {
                    var t = Math.floor((this.maxTimeAdd - Date.now()) / 1e3);
                    this._lab.$Label.string = Math.floor(t / 60) + "m" + (t % 60);
                } else {
                    this.unscheduleAllCallbacks();
                    this.resetData();
                }
            };
            e.prototype.moveTimeCall = function (t) {
                "1" == t && this.resetData();
            };
            e.prototype.resetData = function () {
                if (0 == this.type) {
                    if (PayData.getMulAdd2Pro() > 1) {
                        this._clickNode.active = !1;
                        PayData.setCostMul20(1);
                    }
                } else if (1 == this.type && PayData.getMulAdd5Pro() > 1) {
                    this._clickNode.active = !1;
                    PayData.setCostMul5(1);
                }
            };
            e.prototype.checkOver = function (t, e) {
                return t < e;
            };
            e.prototype.init = function () {};
            n([c(cc.Node)], e.prototype, "viewClick", void 0);
            n([c()], e.prototype, "type", void 0);
            return n([s], e);
        })(Thor));
o.default = p;
